Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement(rpc-server): Add additional logs for shadow_data_consistency #93

Merged
merged 3 commits into from
Aug 3, 2023

Conversation

kobayurii
Copy link
Member

@kobayurii kobayurii commented Jul 20, 2023

#92
In this pr we improve shadow_data_consistency logs.

Data may mismatch in 4 cases:

  1. Both services(read_rpc and near_rpc) have a successful response
    if data mismatch we are logging into shadow_data_consistency_successful_responsesboth response objects for future investigation.
  2. read_rpc - failure, near_rpc - successful
    we are logging into shadow_data_consistency_read_rpc_failure_response just message about mismatch data without objects. In the future we should be investigate why we got error in the read_rpc.
  3. read_rpc - successful , near_rpc - failure
    we are logging into shadow_data_consistency_near_failure_response just message about mismatch data without objects. Expected that all error will be related with network issues.
  4. Both services have a failure response
    we are logging into shadow_data_consistency_failure_responses both response objects for future investigation.
    Expected we will only have a difference in the error text.

@kobayurii kobayurii self-assigned this Jul 20, 2023
Copy link
Member

@khorolets khorolets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like you to add docstrings to the functions you introduce for readability. This is a general request from me.

Also, could you please consider the changes I've proposed? The change would also affect other places, so I'm not commenting on those.

I can't entirely agree with the place for the log message for data consistency. However, I don't have any better suggestions.

rpc-server/src/modules/blocks/utils.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@telezhnaya telezhnaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you covered the thing that we should give different logs:

  • when both answers are successful, but they do not match
  • when one or both answers were not able to be collected properly
    ?

@kobayurii
Copy link
Member Author

Have you covered the thing that we should give different logs:

  • when both answers are successful, but they do not match
  • when one or both answers were not able to be collected properly
    ?

I haven't forgotten. I analyzed the situation and found a case when an error is normal. For example, if the block does not exist then both services return an error and we need to compare these errors and make sure that we return the same error as near_rpc. At the moment I just added the compared objects to the logging, I hope this will improve the situation with the investigation of mismatching.

Copy link
Member

@khorolets khorolets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My requests and concerns were addressed. I am approving, though I wouldn't merge until @telezhnaya approves.

Copy link
Collaborator

@telezhnaya telezhnaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but this does not address the thing I've asked for. The initial idea was to simplify the logs and help to identify the cases when both services give successful results, and these results do not match. You haven't covered this.

@kobayurii
Copy link
Member Author

Sorry, but this does not address the thing I've asked for. The initial idea was to simplify the logs and help to identify the cases when both services give successful results, and these results do not match. You haven't covered this.

You are right! I lost some moments and I will improve code coming soon. Sorry for that!

@kobayurii kobayurii force-pushed the add_retry branch 2 times, most recently from 5a25ede to 3a258b9 Compare July 23, 2023 18:47
@kobayurii kobayurii force-pushed the add_retry branch 2 times, most recently from d332da5 to ba203e6 Compare July 23, 2023 19:20
@kobayurii kobayurii changed the title 1. Add retry to get objects from s3 bucket Improvement(rpc_server): Add retrying to fetch object from s3 and add additional logs for shadow_data_consistency Jul 24, 2023
@khorolets khorolets changed the title Improvement(rpc_server): Add retrying to fetch object from s3 and add additional logs for shadow_data_consistency Improvement(rpc-server): Add retrying to fetch object from s3 and add additional logs for shadow_data_consistency Jul 24, 2023
Copy link
Member

@khorolets khorolets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed PR description. I'm leaving some changes request, but I still need to review the PR.
I am thinking about the way ResponseState works. I feel it should be improved, but I can't concentrate right now to tell how.

rpc-server/src/modules/transactions/methods.rs Outdated Show resolved Hide resolved
rpc-server/src/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/modules/blocks/methods.rs Outdated Show resolved Hide resolved
rpc-server/src/modules/blocks/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/modules/blocks/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/modules/blocks/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/modules/blocks/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/utils.rs Outdated Show resolved Hide resolved
rpc-server/src/modules/blocks/utils.rs Outdated Show resolved Hide resolved
@kobayurii kobayurii force-pushed the add_retry branch 2 times, most recently from b37ec6f to 8dc190a Compare July 24, 2023 19:11
@kobayurii kobayurii changed the title Improvement(rpc-server): Add retrying to fetch object from s3 and add additional logs for shadow_data_consistency Improvement(rpc-server): Add additional logs for shadow_data_consistency Jul 26, 2023
Copy link
Collaborator

@telezhnaya telezhnaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no more major issues here.
But, this does not fix #92, please check it's not closed automatically after the merge
Thank you

// Both services(read_rpc and near_rpc) have a successful response
// if data mismatch we are logging into `shadow_data_consistency_successful_responses`
// both response objects for future investigation.
tracing::warn!(target: "shadow_data_consistency_successful_responses",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduction of couple of new targets really bothers me. Can you reuse the shadow_data_consistency we already have and instead define the cause of the warning in the log message itself, please?

let read_rpc_response_json = match &result {
Ok(res) => serde_json::to_value(res),
Err(err) => serde_json::to_value(err),
let (read_rpc_response_json, response_success) = match &result {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel response_success is a good name for this variable. Maybe something like is_response_ok (is_ could help identify it's a bool, _ok is closer to what we deal with). What do you guys think @kobayurii @telezhnaya ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% agree

2. Logs inmprovements for shadow_data_consistency. Add Full objects in log if data mismatch
)
};
return Err(ShadowDataConsistencyError::ResultsDontMatch(format!(
"{err}. Reason: {reason}. Description {description}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you post an example of such input for clarity, please?

Copy link
Member Author

@kobayurii kobayurii Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Sure.
exampl.log

@khorolets
Copy link
Member

@kobayurii @telezhnaya
I've talked to @gmilescu and he suggested us splitting the errors in the counters. Something like:

  • block_error_proxies_counter_0 - RR success, AR success - data mismatch
  • block_error_proxies_counter_1 - RR success, AR error
  • block_error_proxies_counter_3 - RR error, AR success

This is pretty similar to what @kobayurii did in this PR for separating logs. What do you think? I guess we should merge this PR and open a separate followup issue to cover the idea described.

@khorolets khorolets merged commit bfb1dba into main Aug 3, 2023
3 checks passed
@kobayurii kobayurii deleted the add_retry branch December 20, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants